Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation of models.circuit.Circuit #1544

Merged
merged 6 commits into from
Dec 16, 2024
Merged

Fix documentation of models.circuit.Circuit #1544

merged 6 commits into from
Dec 16, 2024

Conversation

renatomello
Copy link
Contributor

@renatomello renatomello commented Dec 16, 2024

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@renatomello renatomello added the documentation Improvements or additions to documentation label Dec 16, 2024
@renatomello renatomello added this to the Qibo 0.2.15 milestone Dec 16, 2024
@renatomello renatomello self-assigned this Dec 16, 2024
Example:
.. testcode::
.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to understand: was there any issue with the testcode directive?

Copy link
Contributor Author

@renatomello renatomello Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testcode does not display the code in the compiled documentation, leaving the example blank in the doc https://qibo.science/qibo/stable/api-reference/qibo.html#qibo.models.circuit.Circuit + all these different initializations are being tested in the regular tests anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'm not sure why it is happening, since in principle even testcode blocks should be shown, according to Sphinx
https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html#directive-testcode

By default it is shown as a highlighted code block.

(there is an explicit attribute :hide: to avoid showing it).

I wonder why... but a workaround is still better than an empty block. Thanks for the fix!

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (4588671) to head (f5b93b4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1544   +/-   ##
=======================================
  Coverage   99.68%   99.68%           
=======================================
  Files          80       80           
  Lines       11607    11607           
=======================================
  Hits        11571    11571           
  Misses         36       36           
Flag Coverage Δ
unittests 99.68% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 124 to 125
Example:
.. testcode::
.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle, you could replace this with:

    Example::

The double colon is a short-cut in Sphinx for a code block, with the default syntax (which in our case, the default, it's just Python).
https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks

@renatomello renatomello added this pull request to the merge queue Dec 16, 2024
Merged via the queue into master with commit 3713524 Dec 16, 2024
24 of 25 checks passed
@renatomello renatomello deleted the fix_doc branch December 16, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants